<?php

/**
 * 物流厂家管理
 * Enter description here ...
 * @author Admin
 *
 */
class Express_factoryAction  extends CommonAction{

	
	/**
	 * 物流厂家列表
	 * Enter description here ...
	 */
	public function index() {
		Log::write('物流厂家管理列表start：', Log::DEBUG);
		
		
		$name =  $_REQUEST['name'];      //检索条件
		$this->assign("name",$name);  
		
		if (!empty($name)){
			$map['name']= array('like',"%{$name}%"); 
		}
		
			
		$expressfactory = D('Express_factory');
			
		
		import("@.ORG.Page"); //导入分页类
		
		$count = $expressfactory->where($map)->count();    //计算总数
		
		$p = new Page ($count,12);  //分页
		
		$expressfactoryData=$expressfactory
			->where($map)
			->limit($p->firstRow.','.$p->listRows)
			->order('id desc')  
			->findAll();
			
		
		//...分页检索条件	
		$p->parameter = "name=" . urlencode ( $_REQUEST['name'] ) . "&";
		
		
		$page = $p->show ();
		
		$this->assign("page",$page);
		$this->assign("expressfactoryData",$expressfactoryData);
		

		Log::write('物流厂家管理列表end：', Log::DEBUG);
		
		$this->display();
	}
	
	
	
	
	
	
	
	/**
	 * 保存
	 * @see CommonAction::insert()
	 */
	public function insert(){
		Log::record('保存物流厂商信息start', Log::DEBUG);
		Log::save();
		
		$data = Init_GP(array('name','address','tel','state'));  
		
		parent::insert($data);
		
		Log::record('保存物流厂商信息end', Log::DEBUG);
		Log::save();
	}
	
	
	
	/**
	 * 修改保存
	 * @see CommonAction::update()
	 */
	public function update(){
		$id = GetNum($_POST['id']);  //主键
		
		Log::write('物流厂家修改start：'.$id , Log::DEBUG);
		
		$map['id'] = array('eq',$id);
		$data = Init_GP(array('name','address','tel','state'));
		
		Log::write('物流厂家修改end：', Log::DEBUG);
		
		parent::update($data,$map);
	}
	
	

	
   
}
?>